package cc.openkit.kitwebapi.demo;

import cc.openkit.kitmodel.demo.Demo;
import cc.openkit.kitservice.demo.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class DemoController {

    @Autowired
    private DemoService demoService;

    @ResponseBody  // 返回 json 数据
    @GetMapping("add")
    private Demo add(){
        Demo demo = new Demo();
        demo.setName("贲海龙");
        demo.setId(2);
        return demoService.addOne(demo);
    }

}
